class session {
    constructor() {
        this._session = Object.create(null);
        this._updated = false;
    }

    set(key, value) {
        this._updated = true;
        this._session[key] = value;
    }

    get(key) {
        return this._session[key] || null;
    }

    getAll() {
        return this._session;
    }

    remove(key) {
        this._updated = true;
        delete this._session[key];
    }

    removeAll() {
        this._updated = true;
        this._session = Object.create(null);
    }

    isNull() {
        return Object.keys(this._session).length == 0;
    }
}

module.exports = session;